﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Pai.LiveStation.Web
{
    public static class MediaHelper
    {
        public static string UploadFile(HttpPostedFileBase file)
        {
            if (file.ContentLength > 0)
            {
                Byte[] destination = new Byte[file.ContentLength];
                file.InputStream.Read(destination, 0, file.ContentLength);

                MediaService ms = new MediaService();
                string uploadedFile = ms.UploadFile(destination, file.FileName);

                return uploadedFile;
            }
            else
                return null;
        }
    }
}